package com.jf.identity.controller;

import com.jf.identity.entity.DeviceFeedBack;
import com.jf.identity.entity.ResponseBean;
import com.jf.identity.service.DeviceInfoService;
import com.jf.identity.util.Params;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by x on 2018/4/14.
 */
@Controller
@RequestMapping("vis")
public class DeviceInfoController {
    @Resource
    private DeviceInfoService deviceInfoService;

    @RequestMapping(value = "set-identity-deviceinfo")
    @ResponseBody
    public ResponseBean setIdentityDeviceInfo(@Validated @RequestBody DeviceFeedBack deviceFeedBack,
                                              BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        return new ResponseBean(deviceInfoService.insertDeviceInfo(deviceFeedBack.getDevices()));
    }

}
